package com.ssm.gbq.service.impl;

import com.ssm.gbq.mapper.DoctorMapper;
import com.ssm.gbq.model.Doctor;
import com.ssm.gbq.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 医生service层
 *
 * @Author ssm
 * @Date 2020/5/18 17:56
 */
@Service
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;

    /**
     * 获取医生列表
     * @param doctor
     * @return
     */
    @Override
    public List<Doctor> selectDoctorList(Doctor doctor) {
        return doctorMapper.selectDoctorList(doctor);
    }

    /**
     * 添加医生信息
     * @param doctor
     * @return
     */
    @Override
    public int insertDoctor(Doctor doctor) {
        doctor.setCreateTime(new Date());
        return doctorMapper.insertDoctor(doctor);
    }

    /**
     * 修改医生信息
     * @param doctor
     * @return
     */
    @Override
    public int updateDoctor(Doctor doctor) {
        return doctorMapper.updateDoctor(doctor);
    }

    /**
     * 删除医生信息
     * @param id
     * @return
     */
    @Override
    public int delDoctorById(Integer id) {
        return doctorMapper.delDoctorById(id);
    }

    /**
     * 搜索医生信息
     * @param doctors
     * @return
     */
    @Override
    public List<Doctor> serchDoctor(Doctor doctors) {
        return doctorMapper.selectDoctorByPhoneOrName(doctors);
    }


}
